package sample;

import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

/**
 * @author ml
 * @create 2017-11-17--15:50
 */
public class UpDialog extends AnchorPane {

    private static UpDialog upDialog;

    private static UploadController controller;

    private static Stage stage;

    private  static ObservableList<Person> pList;

    private UpDialog(){
        try {
            FXMLLoader fxmlLoader=new FXMLLoader(getClass().getResource("upload.fxml"));
            Parent root=fxmlLoader.load();
            stage=new Stage();
            stage.setResizable(false);
            stage.setTitle("拼命中...");
            stage.setScene(new Scene(root,300,275));

            controller=fxmlLoader.getController();


        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void showUpload(ObservableList<Person> data){
        pList=data;
        upDialog=new UpDialog();
        if(stage!=null){
            stage.show();
            controller.start(upDialog);

        }
    }

    public void hide(){
        if(stage!=null){
            stage.hide();
        }
    }

    public ObservableList<Person> getPList(){
        return pList;
    }




}
